﻿namespace Core
{
    public class DSBool : DSVar, IToInt
    {
        private bool mValue;

        public bool Value
        {
            get => mValue;
            set
            {
                mValue = value;
                onChange?.Invoke();
            }
        }

        public int ToInt() => mValue ? 1 : 0;

        public override string ToString() => Value.ToString();

        public override void Dispose()
        {
            if (IsDisposed) return;
            base.Dispose();

            mValue = false;
        }
    }
}
